
#ifndef ACTION_H
#define ACTION_H

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "../zipwriter.h"
class Action
{
public:
    
    Action(const char* i ){
		this->identifier = new char[strlen(i)+1];
		strcpy(this->identifier,i);
    }

    ~Action(){
	if(this->identifier) delete this->identifier;
     }

    virtual void execute(int arg, char** args) = 0;
    virtual void showFailed() = 0;
    bool compareIdentifier(const char* compare){
        return strcmp(this->identifier,compare)==0;
    }

    virtual void showInformation() = 0;

private:
   char* identifier;

};

class Compress: public Action
{
public:
    Compress():Action("-c"){
    }

    void execute(int arg, char** args){
        while(*args){
            printf("%s\n",*args);
            args++;
        }
    }

    void showFailed(){
        printf("ShowFailed");
    }

    void showInformation(){
        printf("\t-c : This option allows compress a file \n\t Args :  Source path - Destination path\n");
    }
};

class DeCompress : public Action
{
public :
    DeCompress():Action("-d"){
    }

    void execute(int arg, char** args){
        while(*args){
            printf("%s\n",*args);
            args++;
        }
    }

    void showFailed(){
        printf("ShowFailed");
    }

    void showInformation(){
        printf("\t-d : This option allows decompress a zip file \n\t Args :  zip file name path - Destination path\n");
    }
};


#endif // ACTION_H
